﻿using QBWeb.Models.CurriculumFolder;
using QBWeb.Models.QuestionFolder;
using QBWeb.Models.TestFolder;

namespace QBWeb.Models
{
    using Microsoft.AspNet.Identity.EntityFramework;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.ModelConfiguration.Conventions;
    using System.Linq;

    public class QBDbContext : IdentityDbContext<ApplicationUser>
    {
        public static QBDbContext Create()
        {
            return new QBDbContext();
        }
        //您的上下文已配置为从您的应用程序的配置文件(App.config 或 Web.config)
        //使用“QBDbContext”连接字符串。默认情况下，此连接字符串针对您的 LocalDb 实例上的
        //“QBWeb.Models.QBDbContext”数据库。
        // 
        //如果您想要针对其他数据库和/或数据库提供程序，请在应用程序配置文件中修改“QBDbContext”
        //连接字符串。
        public QBDbContext()
            : base("name=QBDbContext")
        {
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
        }
        public DbSet<UserNameTb> UserNameTbs { get; set; }
        public DbSet<QuestTypeTb> QuestTypeTbs { get; set; }

        public DbSet<QuestionTb> QuestionTbs { get; set; }

        public DbSet<SingleChoiceTb> SingleChoiceTbs { get; set; }

        public DbSet<TrueFalseTb> TrueFalseTbs { get; set; }
  
        public DbSet<BlanksTb> BlanksTbs { get; set; }
        public DbSet<MultiChoiceTb> MultiChoiceTbs { get; set; }
        public DbSet<BriefTb> BriefTbs { get; set; }

        public DbSet<TestPaperTb> TestPaperTbs { get; set; }
        public DbSet<Anouncement> Anouncements { get; set; }


        //public DbSet<TestDetailsTb> TestPapers { get; set; }

        public DbSet<TestDetailsTb> TestDetails { get; set; }
        public DbSet<SubjectTb> SubjectTbs { get; set; }
        public DbSet<Curriculum> Curricula { get; set; }
        public DbSet<ClassesTb>   ClassesTbs { get; set; }
        public  DbSet<Curri_StudentTb> CurriStudentTbs { get; set; }
        public  DbSet<Classes_StudentTb> ClassesStudentTbs { get; set; }

        //public DbSet<User> Users { get; set; }  //废弃

        public DbSet<BigKnowModuleTb> BigKnowModuleTbs { get; set; }
        public DbSet<SmallKnowModuleTb> SmallKnowModuleTbs { get; set; }
        public DbSet<Issue> Issues { get; set; }
        public DbSet<Class_TestPaperTb> ClassTestPaperTbs { get; set; }

        public DbSet<AnswerInfoTb> AnswerInfoTbs { get; set; }
        public DbSet<AnswerRecordTb> AnswerRecordTbs { get; set; }
        //为您要在模型中包含的每种实体类型都添加 DbSet。有关配置和使用 Code First  模型
        //的详细信息，请参阅 http://go.microsoft.com/fwlink/?LinkId=390109。

        // public virtual DbSet<MyEntity> MyEntities { get; set; }
    }

    //public class MyEntity
    //{
    //    public int Id { get; set; }
    //    public string Name { get; set; }
    //}
}